package com.dff.jrfw.service;

import android.os.Build;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;

import androidx.annotation.RequiresApi;

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
public class MyNotificationListenerService extends NotificationListenerService {

    private boolean listenerConnected;

    @Override
    public void onListenerConnected() {
        super.onListenerConnected();
        listenerConnected = true;
    }

    @Override
    public void onListenerDisconnected() {
        super.onListenerDisconnected();
        listenerConnected = false;
    }

    @Override
    public void onNotificationPosted(StatusBarNotification sbn) {
        Log.i("NotificationListener","Notification posted");
    }

    @Override
    public void onNotificationRemoved(StatusBarNotification sbn) {
        Log.i("NotificationListener","Notification removed");
    }

    @Override
    public void onCreate() {
        super.onCreate();
//        new Handler().postDelayed(new Runnable() {
//            @Override
//            public void run() {
//                Log.d("ssssss", " NotificationListenerService onCreate, notification count ：" + getActiveNotifications().length);
//            }
//        },100);
    }
}
